/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bff.mpd.musicjukebox.lib.actions;

import com.bff.mpd.utils.Utils;
import java.awt.event.ActionEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
import org.bff.javampd.MPDPlaylist;
import org.bff.javampd.objects.MPDGenre;

/**
 *
 * @author bfindeisen
 */
public class PlaylistInsertGenreAction extends AbstractAction {

    private MPDPlaylist playlist;
    private MPDGenre genre;

    public PlaylistInsertGenreAction(MPDPlaylist playlist,
            MPDGenre genre) {
        super(Utils.getMessage("ACTION_ADD_GENRE_NAME"));
        this.playlist = playlist;
        this.genre = genre;
        putValue(Action.SHORT_DESCRIPTION, Utils.getMessage("ACTION_ADD_GENRE_SHORT_DESC"));
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        try {
            playlist.insertGenre(getGenre());
        } catch (Exception ex) {
            Logger.getLogger(PlaylistInsertGenreAction.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /**
     * @return the playlist
     */
    public MPDPlaylist getPlaylist() {
        return playlist;
    }

    /**
     * @param playlist the playlist to set
     */
    public void setPlaylist(MPDPlaylist playlist) {
        this.playlist = playlist;
    }

    /**
     * @return the artist
     */
    public MPDGenre getGenre() {
        return genre;
    }

    /**
     * @param artist the artist to set
     */
    public void setGenre(MPDGenre genre) {
        this.genre = genre;
    }
}
